/** @jsxImportSource @emotion/react */
import * as React from "react";
import {  OriginalViewProps,  } from "../../common/base";
import {config设备概况, EntranceSetup} from "./orcBase";
import { createItem,  } from "../../common/eHelper";
import { useRecordListSubr} from "../../hook/useRecordListSub";
import {DeviceSurvey} from "../../elevator/editor";
import {PropertySolidify} from "../../industrial/EditorFeature";
import {SingleLineDiagram} from "../../industrial/editorLineDg";
import {ProjectListNj } from "../../industrial/Projects";
import {ConclusionGasC} from "../../gas/editorJj";
import {ThreeConfigRaft} from "../../gas/editor";
import {IPipingUnitEntity} from "../../../comp/ChoosePipingUnits";
import {JobResponsibili} from "./JobResponsibili";
import {ProblemHandle} from "../../gas/ldistanceJj/ProblemHandle";
import {证书除概况} from "./CertificatePage";
import {SiteConstruct} from "../../gas/ldistanceJj/SiteConstruct";
import {NonDestructive} from "../../gas/ldistanceJj/NonDestructive";
import {QualityAssure} from "./QualityAssure";
import {WeldingQualif} from "../../gas/ldistanceJj/WeldingQualif";


export const Projects默认=[{name:'公用热力管道施工监督检验结论报告',do:true,ha:'Conclusion'},
  {name:'受检单位基本情况及现场施工',ml:'受检单位基本情况及现场施工情况报告',ha:'SiteConstruct'},
  {name:'焊接作业人员资格',ml:'现场焊接作业人员资格明细表',ha:'WeldingQualif'},
  {name:'无损检测人员资格明细表',ha:'NonDestructive'},
          //旧的PDF需要附 加一个纸张页 "监检工作内容和检验结果报告2":
  {name:'监检工作内容和检验结果报告',ha:'JobResponsibili'},
  {name:'发现问题的处理',ml:'监检过程中发现问题的处理情况报告',ha:'ProblemHandle'},
  {name:'施工单位质量保证体系',ml:'公用燃气管道施工单位质量保证体系实施状况评价报告',ha:'QualityAssure'},
    //目录中 不显示出 特性表；
  {name:'管道特性表',do:true,ha:'Characteristics',zs:true},
  {name:'管道单线图',ha:'PipeLineDiagram',},
  {name:'特种设备监督检验证书',do:true,ha:'Certificate',na:true},
];

const 检验结果选=['符合','不符合','无此项'];

const recordPrintList =[
  createItem('Entrance', <EntranceSetup/>),
  createItem('ProjectList', <ProjectListNj  projects={Projects默认}/>),
  createItem('Survey', <DeviceSurvey config={config设备概况} label={'施工监督检验结论报告-设备概况'}/>),
  createItem('Conclusion', <ConclusionGasC label={'结论报告-下结论'} nmemo />),

  createItem('SiteConstruct', <SiteConstruct label={'受检单位基本情况及现场施工情况报告'}/>),
  createItem('WeldingQualif', <WeldingQualif label={'现场焊接作业人员资格明细表'}/>),
  createItem('NonDestructive', <NonDestructive label={'无损检测人员资格明细表'}/>),

  createItem('JobResponsibili', <JobResponsibili label={'监检工作内容和检验结果报告, 1-12'} part={0}/>),
  createItem('JobResponsibili_12', <JobResponsibili label={'监检工作内容和检验结果报告, 13-22'} part={1}/>),
  createItem('JobResponsibili_22', <JobResponsibili label={'监检工作内容和检验结果报告, 23-29'} part={2}/>),

  createItem('ProblemHandle', <ProblemHandle label={'监检过程中发现问题的处理情况报告'}/>),
  createItem('QualityAssure', <QualityAssure label={'公用热力管道施工单位质量保证体系实施状况评价报告'} datalist={检验结果选}/>),
  createItem('CertificateSummary', <ThreeConfigRaft config={证书除概况} label={'特种设备监督检验证书'}>
          以上是证书特有的待录入字段，其它的是在结论报告中录入。
           </ThreeConfigRaft>),
  createItem('Solidify', <PropertySolidify label={'管道特性表-管理器'} filterCB={modelToRepData}/>),
  createItem('LineDiagram', <SingleLineDiagram />),
  createItem('_Controller',  <></>),
];


//从Relay模型获取报告才需要的字段：svp pa只保存有用到的字段：节约存储
function modelToRepData(pipe:IPipingUnitEntity){
  const {id,crDate,name,code,leng,level,start,stop,lay,thik,rno,dia,svp,pa}=pipe as any;
  const {材料,设压,设温,直径}=svp;
  const {工介,工压,工温,图号}=pa;
  return { id,crDate, name,code,leng,level,start,stop,lay,thik,rno,dia,
    svp:{材料,设压,设温,直径},
    pa:{工介,工压,工温,图号}
  };
}

export const OriginalView=
  React.forwardRef((
    { action: modAction,  verId, repId='', rep}
    :OriginalViewProps, ref
  ) => {
    const {list}=useRecordListSubr(ref,rep,recordPrintList,modAction,verId);
    return <React.Fragment>
      {list}
    </React.Fragment>;
} );
